//选手数据分析
import * as echarts from "echarts";
import store from "../store";
let tableonename = store.getters.getPlayerName
let playerchuchang = store.getters.getPlayerCCnum
let KDA = store.getters.getPlayerKDA
let MVP = store.getters.getPlayerMVP
// let PKmoney = store.getters.getPlayerPK

let dataX = [...tableonename]; //名称
let dataY = [...playerchuchang]; //数据
let zoomShow = false;
if (dataY.length > 14) {
  zoomShow = true;
} else {
  zoomShow = false;
}
let option = {
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "none",
    },
  },
  legend: {
    //selectedMode: false, //取消图例上的点击事件
    data: ["出场次数", "KDA", "MVP总数"],
    itemWidth: 15,
    itemHeight: 12,
    textStyle: {
      fontSize: "10",
      color: "#fff",
    },
  },
  grid: {
    top: "12%",
    right: "5%",
    left: "5%",
    bottom: "5%",
    containLabel: true,
  },
  yAxis: [
    {
      type: "category",
      inverse: true,
      data: dataX,
      axisLine: {
        lineStyle: {
          color: "rgba(66, 192, 255, .3)",
        },
      },
      axisLabel: {
        interval: 0,
        margin: 10,
        color: "#FFF",
        textStyle: {
          fontSize: 11,
        },
      },
      axisTick: {
        //刻度
        show: false,
      },
    },
  ],
  xAxis: [
    {
      axisLabel: {
        padding: [3, 0, 0, 0],
        formatter: "{value}",
        color: "#FFF",
        textStyle: {
          fontSize: 11,
        },
      },
      axisTick: {
        show: false,
      },
      axisLine: {
        show:true,
        lineStyle: {
          color: "rgba(66, 192, 255, .3)",
        },
      },
      splitLine: {
        lineStyle: {
          color: "rgba(255,255,255,0)",
        },
      },
    },
  ],
  dataZoom: [
    //滚动条
    {
      type: "slider",
      show: false,
      realtime: true,
      start: 0,
      end: 4,
      yAxisIndex: [0 ,1],
      borderColor: "rgba(0,0,0,0)",
      textStyle: {
        color: "#05D5FF",
      },
    },
    {
      type: "inside",  // 支持内部鼠标滚动平移
      yAxisIndex: [0 ,1],
      zoomOnMouseWheel: false,  // 开启滚轮缩放
      moveOnMouseMove: true, //鼠标滚轮触发滚动
      moveOnMouseWheel: true,
    }
  ],
  series: [
    {
      name: "出场次数",
      type: "bar",
      stack: "数据",
      data: dataY,
      barWidth: "10",
      itemStyle: {
        barBorderRadius: 20,
        color: new echarts.graphic.LinearGradient(0,0,1,0,[
          {offset: 1, color: "rgba(55,255,249,1)",},
          {offset: 0, color: "rgba(0,222,215,0.2)",},
        ]),
      },
    },
    {
      name: "KDA",
      type: "bar",
      stack: "数据",
      barWidth: "10",
      itemStyle: {
        normal: {
          barBorderRadius: 5,
          color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
            { offset: 1, color: "rgba(224,28,9,1)" },
            { offset: 0, color: "rgba(162,51,36,0.3)" },
          ]),
        },
      },
      data: [...KDA],
    },
    {
      name: "MVP总数",
      type: "bar",
      stack: "数据",
      barWidth: "10",
      itemStyle: {
        normal: {
          barBorderRadius: 5,
          color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
            { offset: 1, color: "rgba(115,132,246,1)" },
            { offset: 0, color: "rgba(115,132,246,0.3)" },
          ]),
        },
      },
      data: [...MVP],
    },
    // {
    //   name: "对位经济差",
    //   type: "bar",
    //   stack: "数据",
    //   barWidth: "10",
    //   itemStyle: {
    //     normal: {
    //       barBorderRadius: 5,
    //       color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
    //         { offset: 1, color: "rgba(164,19,60,1)" },
    //         { offset: 0, color: "rgba(112,81,90,0.3)" },
    //       ]),
    //     },
    //   },
    //   data: [...PKmoney],
    // },
  ],
};
export {option}
